﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NUnit.Framework;

using BOSS.Dao.Security;
using BOSS.Domain.Security;

namespace Test.BOSS.Dao.NHibernate.Security
{
    [TestFixture]
    public class TestAccountDao : TestCase
    {
        public IAccountDao AccountDao { get; set; }

        [Test]
        public void Test()
        {
            Assert.IsNotNull(this.AccountDao);
        }

        [Test]
        public void TestFindById()
        {
            Account account = this.AccountDao.FindById(1);


            Assert.IsNotNull(account);

            if (account != null)
            {
                Console.WriteLine(string.Format("姓名:{0}, 电话:{1}", account.FullName, account.Telephone));
            }

            account.FullName = "ben.fang";

            this.AccountDao.SaveOrUpdate(account);

        }

        [Test]
        public void TestFindByName()
        {
            Account account = this.AccountDao.FindByLoginName("admin");

            Assert.IsNotNull(account);

            if (account != null)
            {
                Console.WriteLine(string.Format("姓名:{0}, 电话:{1}", account.FullName, account.Telephone));
            }
        }
    }
}
